setwd("E:/5hmc_file/figure/727功能富集图")
library(openxlsx)
library(ggplot2)
file=read.xlsx("c7f96db3-5d8a-4064-82d5-01073aba5a85.xlsx",sheet = 2)
file=file[file$Category=="Disease",]
file$gene_ratio=file$Hit.Count.in.Query.List/file$Hit.Count.in.Genome
file$num=5:1
ratio_end=round(max(file$gene_ratio),2)

ggplot(file,aes(gene_ratio,num))+geom_point(aes(size=Hit.Count.in.Query.List,color=`q-value.FDR.B&H`))+
  scale_color_gradient(low = "#E64B35", high = "#3C5488")+
  scale_y_continuous(breaks = file$num,labels = file$Name)+
  scale_x_continuous(limits=c(0, ratio_end+0.04), breaks=seq(0, ratio_end+0.04, 0.05))+theme_bw()+
  theme(panel.grid.minor = element_blank())+labs(title = "Disease")


ggplot(data=file,aes(x=num,y=gene_ratio,fill=`q-value.FDR.B&H`))+scale_x_continuous(breaks = file$num,labels = file$Name)+
geom_bar(stat="identity") + coord_flip()+scale_y_continuous(limits=c(0, ratio_end+0.04), breaks=seq(0, ratio_end+0.04, 0.05))+
theme(panel.background=element_rect(fill='transparent',color='gray'),axis.text.y=element_text(color="black",size=12))+
scale_fill_gradient(low = "#E64B35", high = "#3C5488")+
labs(x="",y="",title="Disease")
